package com.igeek.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.igeek.entry.Item;
import com.igeek.service.ProService;

@Controller
public class ProController {
	@Resource
	private ProService proService;
     
	@RequestMapping("showPro.action")
	public ModelAndView showProList() {
		List<Item> itemList=proService.findAll();
		ModelAndView mav = new ModelAndView();
		mav.addObject("itemList",itemList);
		mav.setViewName("itemList");
		return mav;
	}
	
	
	@RequestMapping("editPro.action")
	public ModelAndView editPro(Integer id) {
		Item item=proService.findItemById(id);
		ModelAndView mav = new ModelAndView();
		mav.addObject("item",item);
		mav.setViewName("editItem");
		return 	mav;
		
	
	}
	
}
